﻿@page "/menu"
@inject IDataService<MenuEntity> DataService
@inject IAdminService IAdminService
@using BBCore.Server.Components.Pages.Admins.Icon
@using BBCore.Server.Components.Pages.Samples
@attribute [TabItemOption(Text = "菜单管理", Icon = "fa-fw fa-solid fa-desktop")]
<EasyAdminTable TItem="MenuEntity" OnSaveAsync="OnSaveAsync" OnDeleteAsync="OnDeleteAsync" IsTree="true" TreeNodeConverter="TreeNodeConverter"
            IsPagination="false" IsMultipleSelect="true" ShowDetailRow="@ShowDetailRow" ShowRefresh="false">
    <TableColumns>
        <TableColumn @bind-Field="@context.MenuName" Filterable="true" Sortable="true"></TableColumn>
        <TableColumn @bind-Field="@context.Id" Text="菜单编号" Readonly="true"></TableColumn>
        <TableColumn @bind-Field="@context.Icon">
            <Template Context="v">
                <i class="text-info cell-icon @v.Value"></i>
            </Template>
            <EditTemplate Context="v">
                <SelectIconEditor_HYJ Value="v"></SelectIconEditor_HYJ>
            </EditTemplate>
        </TableColumn>
        <TableColumn @bind-Field="@context.Url" PlaceHolder="例如:/menu"></TableColumn>
        <TableColumn @bind-Field="@context.ParentId" Visible="true" Text="父菜单">
            <EditTemplate Context="value">
                <div class="col-12 col-sm-6 col-md-6">
                    <SelectTree @bind-Value="value.ParentId" Items="Items" DisplayText="父菜单"></SelectTree>
                </div>
            </EditTemplate>
        </TableColumn>
        
        <TableColumn @bind-Field="@context.CN_COLUMNS" PlaceHolder="请输入中文标题,以逗号隔开,单一sql查询这里留空" />
        <TableColumn @bind-Field="@context.Query_Sql" Width="200" TextEllipsis="true" ShowTips="true">
            <EditTemplate Context="v">
                <Textarea @bind-Value="@v!.Query_Sql" placeholder="请输入Sql语句" rows="8"></Textarea>
            </EditTemplate>
        </TableColumn>
    </TableColumns>
    
     <DetailRowTemplate>
       <TempDetails_ControlDetails Model="@context"></TempDetails_ControlDetails>
    </DetailRowTemplate> 
</EasyAdminTable>

